<?php
require('config.php');
		$user_id=$_REQUEST['user_id'];
        $user_name=$_REQUEST['user_name'];
        $user_mobile=$_REQUEST['user_mobile'];
        $address1=$_REQUEST['address1'];
        $address2=$_REQUEST['address2'];
        $address3=$_REQUEST['address3'];
        $address4=$_REQUEST['address4'];
        $jiedao=$_REQUEST['jiedao'];
        $time=date('Y-m-d H:i:s');
		$sql="select * from `".$oto."_user_address` where `userId`='".$user_id."'";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$user_address[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(!isset($user_address))
		{
			$sql="INSERT INTO ".$oto."_user_address (`userId`,`userName`,`userPhone`,`areaId1`,`areaId2`,`areaId3`,`communityId`,`address`,`isDefault`,`createTime`) VALUES ('$user_id','$user_name','$user_mobile','$address1','$address2','$address3','$address4','$jiedao','1','$time')";
            $result=$db->query($sql);
		}
		else
		{
			$sql="INSERT INTO ".$oto."_user_address (`userId`,`userName`,`userPhone`,`areaId1`,`areaId2`,`areaId3`,`communityId`,`address`,`isDefault`,`createTime`) VALUES ('$user_id','$user_name','$user_mobile','$address1','$address2','$address3','$address4','$jiedao','0','$time')";
            $result=$db->query($sql);
		}
		if($result)
		{
			$data[0]['pan']="true";
		}
		else
		{
			$data[0]['pan']="false";
		}
		echo json_encode($data);
?>
